package com.foreknow.mapping;

import java.util.HashMap;
import java.util.Map;

/**
 * 它是一个工厂类
 * 作用是用来管理xxxxMapping对象的
 */
public class MappingFactory {
    private static MappingFactory mappingFactory = null;
    private Map<String,EntityMapping> maps = new HashMap<>();
    public static final String USER_MAPPING = "userMapping";
    public static final String ADMIN_MAPPING = "adminMapping";
    private MappingFactory(){

    }

    public static MappingFactory getInstance() {
        if(mappingFactory==null){
            mappingFactory = new MappingFactory();
            mappingFactory.maps.put(USER_MAPPING,new UserMapping());
        }
        return mappingFactory;
    }

    public EntityMapping getMap(String key) {
        return maps.get(key);
    }
}
